Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build.mill files compiled by Scala 3 #3369

Open
wants to merge 44 commits into
base: main
Choose a base branch
from

Conversation

bishabosha
Copy link
Contributor

@bishabosha bishabosha commented Aug 13, 2024

This is work in progress to fix #3152

Numerous fixes were also needed to com-lihaoyi/mainargs, com-lihaoyi/sourcecode, and com-lihaoyi/mill-moduledefs

With the current state, only 1 example/integration tests is still failing:

  • integration.feature[plugin-classpath].local

known TODOs:

  • Discover macro
  • Applicative macro
  • Caller macro
  • Cross.Factory macro
  • EnclosingClass macro
  • Task macros
  • Cacher macro
  • Moduledefs compiler plugin (override inferrence)
  • All core Mill modules compile with Scala 3.5.0
  • Fix Zinc reporter patch linenumbers of build scripts
  • Check that bytecode analyzers work with Scala 3
  • cleanup library dependency conflicts
  • Support new Scala 3 syntax in build.sc files
  • Fix BSP reporter linenumbers for build scripts (Zinc reporter forwards to bsp)
  • Cleanup compiler warnings for outdated syntax

known incompatibilities:

  • can't use ExplicitResultTypes scalafix rule - need to upgrade mill-scalafix
  • Cross.scala uses the new quoted type syntax which scalafmt crashes on, (and version is frozen) so skip the file upgraded Scalafmt so not skipped anymore
  • skipping Mima currently due to 1000s of errors (perhaps we should generate filters?)
  • filtered one flaky test from example.thirdparty[mockito]
  • filtered out integration.feature[plugin-classpath] due to third party plugin dep

@lihaoyi
Copy link
Member

lihaoyi commented Aug 13, 2024

Thanks @bishabosha ! Lets get your mainargs changes landed, that way we can cut a release and you can test your WIP in CI

@lefou
Copy link
Member

lefou commented Aug 13, 2024

+1 for switching over to using directives!

@bishabosha
Copy link
Contributor Author

@bishabosha bishabosha force-pushed the scala3-build-sc branch 3 times, most recently from 9d1a986 to dc71022 Compare August 16, 2024 09:51
@bishabosha
Copy link
Contributor Author

bishabosha commented Aug 16, 2024

[Edit: after switching to depending on mainargs 0.7.2] in https://github.com/com-lihaoyi/mill/actions/runs/10418081276/job/28853542122?pr=3369 you can see integration tests like example/tasks/6-workers/local passing

@bishabosha
Copy link
Contributor Author

Rebased and included the new mill-moduledefs 0.11.0-M1

@bishabosha bishabosha force-pushed the scala3-build-sc branch 4 times, most recently from a06daca to 37ba541 Compare September 11, 2024 11:19
@bishabosha bishabosha force-pushed the scala3-build-sc branch 5 times, most recently from 917a024 to 78beea1 Compare September 17, 2024 18:59
@bishabosha
Copy link
Contributor Author

bishabosha commented Sep 18, 2024

@bishabosha bishabosha force-pushed the scala3-build-sc branch 9 times, most recently from 022c789 to 368fec9 Compare September 20, 2024 23:18
@bishabosha
Copy link
Contributor Author

@lihaoyi is there any updates to the plan for merging this post 0.12.0?

@lihaoyi
Copy link
Member

lihaoyi commented Oct 24, 2024

@bishabosha let's hold the PR open for now, going forward I can take over responsibilities for keeping the PR up to date so you don't need to maintain it forever.

I don't know exactly how much development we'll see in 0.12.x yet, so not sure when the best time to break bincompat in main will be, but I expect there'll be some short-term follow up from the 0.12.0 release.

  1. Keeping the PR open and occasionally merging main into it would be isomorphic to merging it, cutting a 0.12.x release branch, sending PRs to the release branch and then doing batch-merges into main.

  2. Either of those options would probably be less tedious than having to backport every PR if 0.12.x is still under active development

  3. But keeping the PR open and updated is probably going to be less confusing than cutting/targeting 0.12.x and batch-merging into main

So for now I think it makes the most sense to keep the PR open and periodically merge main into it until we're ready to break bincompat. I can do the work of keeping it up to date with main going forward

@lihaoyi
Copy link
Member

lihaoyi commented Nov 26, 2024

Seems that OS-Lib 0.11.4-M2 is causing an unreasonable compile time slowdown in Scala 3 so sticking with 0.11.3 for now. Probably a consequence of com-lihaoyi/os-lib#329

@lihaoyi
Copy link
Member

lihaoyi commented Nov 26, 2024

merged in latest main and got most tests passing; there are still some stragglers but nothing blocking.

The main thing still missing is proper support for corrected line-numbers and file-names. This kinda-sorta works in certain cases and not others, e.g. sourcecode.Line and sourcecode.File gives the wrong values still

@bishabosha
Copy link
Contributor Author

bishabosha commented Nov 27, 2024

@lihaoyi maybe you can cherry-pick my plugin fixes from https://github.com/bishabosha/mill/tree/scala3-build-sc-reintroduce-linenumbers and https://github.com/bishabosha/mill/tree/scala3-build-sc-reintroduce-linenumbers-with-dotc-patch

From Scala 3.6.2 the backend will accept the line number fix from a plugin without needing hacks

Also I heard that the restriction on pre-typer plugins could potentially be lifted for non .scala files, if one were to make the PR to scala/scala3 - unsure if .sc still applies

@lihaoyi
Copy link
Member

lihaoyi commented Nov 27, 2024

All tests are green. Probably more polish to do esp.w.r.t. error locations, and will need a few more rebases, but hopefully not too many before we merge this in January

@lihaoyi lihaoyi added this to the 0.13.0 milestone Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate build.sc to Scala 3
5 participants